package cn.btks.resultintegration.rule.repository;

import cn.btks.resultintegration.rule.pojo.IndustrialPark;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @Author lijun
 * @Date 2021/2/19 10:40
 */
@Repository
public interface IndustrialParkRepository extends JpaRepository<IndustrialPark,Long> {

    /**
     * 根据产业分类代码查询
     * @param industryCode
     * @return
     */
    List<IndustrialPark> findAllByIndustryCode(Long industryCode);

    /**
     * 根据管控要素编码查询产业名称
     * @param ysgkdybh
     * @return
     */
    @Query(value = "SELECT industry FROM industrial_park WHERE hjysgkfqbm = ?1 GROUP BY industry",nativeQuery = true)
    List<Map<String,Object>> findAllIndustryByGkdybh(String ysgkdybh);
}
